package pages;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;

public abstract class BasePage {
    protected static WebDriver driver;
    protected String URL;
    protected static final By searchStringId = By.className("header-search-input-text");
    protected static final By searchButtonId = By.className("btn-link-i");
    public BasePage(WebDriver driver, String URL) {
        this.driver = driver;
        this.URL = URL;
        PageFactory.initElements(driver, this);
    }

    public boolean PageisOpen() {
        return driver.getCurrentUrl().equals(URL);
    }

    public abstract boolean isLoaded();

    public abstract String getURL();


    public SearchResultPage searchItem(String searchInput) {
        driver.findElement(searchStringId).sendKeys(searchInput);
        driver.findElement(searchButtonId).click();
        return null;
    }}

